﻿@{
    List<KRM.Core.Sections> lstSections = ViewBag.Section;
}
@*<script>
    $(document).ready(function () {
        var height = $(window).height() - 520;
        $(".listfeatures table.krmtable").attr("data-height", height);
    })
</script>*@
<div class="row-fluid">
        <div class="fieldset">
            <div class="row-fluid">
                <div class="listfeatures">
                    <table class="table table-bordered table-fix krmtable tbl-selected" data-height="250">
                        <thead>
                            <tr>
                                <th style="width: 30px !important;"></th>
                                <th>FeatureName</th>
                                <th>GlobalFeature</th>
                                <th>FeatureTypeName</th>
                                <th>PortalAttributeName</th>
                                <th>IsSiteSpecific</th>
                                <th>Group</th>
                            </tr>
                        </thead>
                        <tbody>
                            @foreach (var item in Model)
                            {
                                <tr onclick="featureSelected(@item.FeatureID)">
                                    <td style="text-align: center;">
                                        @if (item.Required)
                                        {
                                            <img src="/img/warning.png" style="width: 20px;"/>
                                        }
                                    </td>
                                    <td>@item.FeatureName</td>
                                    <td>@item.GlobalFeature</td>
                                    <td>@item.FeatureTypeName</td>
                                    <td>@item.PortalAttributeName</td>
                                    <td>@item.IsSiteSpecific</td>
                                    <td>@item.Group</td>
                                </tr>
                            }
                        </tbody>
                    </table>
                </div>
            </div>
            <div class="row-fluid" style="margin-top: 10px;">
                <div class="span4">
                    <div class="span4">Search Features</div>
                    <div class="span8"><input type="text" class="input-block-level" id="txtSearch"/></div>
                </div>
                <div class="span8 text-right">
                    <input type="button" class="btn btn-success w90" value="Add" onclick="PopupCenter('/products/AddFeature',800,350)"/>
                    <input type="button" class="btn btn-danger w90" value="Delete" onclick="deleteFeature()"/>
                </div>
            </div>
        </div>
    </div> 
    <div class="row-fluid" id="box-editfeature">
        <form method="POST" id="fr-editfeature">
            <div class="span5">
                <div class="row-fluid">
                    <div class="fieldset">
                        <div class="legend"><span>Edit Feature</span></div>
                        <div class="row-fluid">
                            <div class="span4">Feature Name</div>
                            <div class="span8"><input name="featurename" type="text" class="input-block-level" required="required"/></div>
                        </div>
                        <div class="row-fluid">
                            <div class="span4">Feature Type</div>
                            <div class="span8">
                                @Html.DropDownList("TypeID", null, new { @class = "input-block-level",@disabled = "disabled"})
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span4">Feature Group</div>
                            <div class="span8">
                                @Html.DropDownList("GroupID", null, new { @class = "input-block-level" })
                            </div>
                        </div>
                        <div class="row-fluid">
                            <div class="span6">
                                <label>
                                    <input type="checkbox" name="issitespecific" class="checkbox"/>
                                    Is Site Specific               
                                </label>
                            </div>
                            <div class="span6">
                                <label>
                                    <input type="checkbox" name="required" class="checkbox"/>
                                    Required
                                </label>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <label>
                                <input type="checkbox" class="checkbox" name="allproducts"/>
                                All products have this feature
                            </label>
                        </div>
                    </div>
                </div>
                <div class="row-fluid">
                    <div class="fieldset">
                        <div class="legend"><span>Shopping Portals (Feature as Attribute)</span></div>
                        <div class="row-fluid">
                            <div class="span4">Name of Attribute</div>
                            <div class="span8">
                                <input type="text" name="nameattribute" class="input-block-level"/>
                            </div>
                        </div>
                        <div class="row-fluid">
                            <label>
                                <input type="checkbox" name="portalenabled" class="checkbox"/>
                                Portal Enabled
                            </label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="span7">
                <div class="fieldset">
                    <div class="legend"><span>Feature Section (Website Template)</span></div>
                    <div class="row-fluid" id="feature-section" style="max-height: 258px;overflow: auto;margin-bottom: 10px;">
                        @foreach (var item in lstSections)
                        {
                            <label>
                                <input type="checkbox" class="checkbox" value="@item.SectionID" />
                                @item.SectionName
                            </label>
                        }
                    </div>
                    
                    <input type="hidden" name="featuresection" id="featuresection" value=""/>
                    <div class="row-fluid text-right">
                        <input type="button" class="btn btn-success w100" value="Edit Sections" onclick="PopupCenter('/products/EditFeatureSections', 800, 500)"/>
                        <input type="submit" class="btn btn-primary w90" value="Save"/>
                    </div>
                </div>
            </div>
        </form>
    </div>